#pragma once

#include <map>

#include "Component.h"
#include "AnimationSequence.h"

namespace game_engine { namespace components
{

/*!
 * \class Animation
 * \brief 
 */
class Animation : public Component
{
///////////////////////////////////////////////////////////////////////////////
// Attribute definition
///////////////////////////////////////////////////////////////////////////////
private:
    string descFile;
    string imageFile;
    utils::Point anchor;
    utils::Size frameSize;
    map<string, AnimationSequence> sequences;
	FLOAT32 sequenceTime;
	INT32 currentFrame;
    string activeSequence;

///////////////////////////////////////////////////////////////////////////////
// Method definition
///////////////////////////////////////////////////////////////////////////////
public:
    // Constructors and Destructors
    Animation(void);
    Animation(GameObject *obj, const string &desc, const string &img);
    virtual ~Animation(void);

    // Others
    const BOOL sequenceExists(const string &sequence) const;
    void resetSequence(void);
    //void drawAtPoint(const Point &point, const string &sequence, 
    //    const INT32 frame) const;

    void initialize(void) throw(...);
    void update(const FLOAT32 time);
    void render(void) throw(...);
    //void finalize(void);

    // Getters
    const utils::Point& getAnchor(void) const;
    const utils::Size& getFrameSize(void) const;
    const AnimationSequence& getSequence(const string &sequence);
    const string& getFirstSequenceName(void) const;
    const string& getActiveSequence(void) const;

    // Setters
    void setDescFile(const string &file);
    void setImageFile(const string &file);
    void setActiveSequence(const string &file);

};

}}
